home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- /*************************************************************************
- *
- * WMenuItem -- Wrapper for the Windows 95 Menu item control.
- *
- *
- * Events:
- *
- * Click --
- *
- * Select --
- *
- * MeasureItem --
- *
- * DrawItem --
- *
- *************************************************************************/
-
- #ifndef _WMENUITM_HPP_INCLUDED
- #define _WMENUITM_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WOBJECT_HPP_INCLUDED
- # include "wobject.hpp"
- #endif
- #ifndef _WSTRING_HPP_INCLUDED
- # include "wstring.hpp"
- #endif
- #ifndef _WMENU_HPP_INCLUDED
- # include "wmenu.hpp"
- #endif
- #ifndef _WBITMAP_HPP_INCLUDED
- # include "wbitmap.hpp"
- #endif
-
- class WMenuItem;
-
- enum WMenuItemType {
- WTextMenuItem = 0x0000,
- WBitmapMenuItem = 0x0040,
- WOwnerDrawnMenuItem = 0x0100,
- };
-
- class WCMCLASS WMenuItem : public WMenuObject {
- WDeclareSubclass( WMenuItem, WMenuObject );
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WMenuItem();
- WMenuItem( WUShort id, const WChar *text=NULL,
- const WChar *htext=NULL,
- WMenuItemType type=WTextMenuItem );
-
- ~WMenuItem();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // Bitmap
-
- WBitmap GetBitmap() const;
- WBool SetBitmap( const WBitmap & bitmap );
-
- // CheckedBitmap
-
- WBitmap GetCheckedBitmap() const;
- WBool SetCheckedBitmap( const WBitmap & bitmap );
-
- // Checked
-
- WBool GetChecked() const;
- WBool SetChecked( WBool checked, WBool exclusive=FALSE );
-
- // Default
- //
- // If TRUE, the menu item is displayed as the default menu
- // item (bolded under Win95).
-
- WBool GetDefault() const;
- WBool SetDefault( WBool isDefault );
-
- // Enabled
-
- WBool GetEnabled() const;
- WBool SetEnabled( WBool enabled, WBool grayIfDisabled=TRUE );
-
- // Grayed
-
- WBool GetGrayed() const;
- WBool SetGrayed( WBool grayed );
-
- // Type
-
- WMenuItemType GetType() const;
- WBool SetType( WMenuItemType type );
-
- // UncheckedBitmap
-
- WBitmap GetUncheckedBitmap() const;
- WBool SetUncheckedBitmap( const WBitmap & bitmap );
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- // OnClick
-
- virtual WBool OnClick();
-
- // OnSelected
-
- virtual WBool OnSelected( WBool selected=TRUE );
-
- /**********************************************************
- * Others
- *********************************************************/
-
- int operator==( const WMenuItem & obj ) const;
- int operator!=( const WMenuItem & obj ) const;
-
- /**********************************************************
- * Overrides
- *********************************************************/
-
- // Text
-
- virtual WString GetText();
- virtual WBool SetText( const WString & text );
-
- /**********************************************************
- * Data members
- *********************************************************/
-
- private:
-
- WBitmap * _bitmap;
- WBitmap * _checkedBitmap;
- WBitmap * _uncheckedBitmap;
- WMenuItemType _type;
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WMENUITM_HPP_INCLUDED
-